<template>
  <view :style="themeColor">
    <view class="page">
      <fu-custom bgColor="bg-white" :isBack="true" :isBottom="true">
        <block slot="content">我要发布</block>
      </fu-custom>

      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout wodefabu_flex_1">
        <view class='flex flex-wrap align-center wodefabu_fd1_0'>
          <text class='wodefabu_fd1_0_c0'>发布类型</text>
        </view>
        <view class='flex flex-direction flex-wrap align-stretch wodefabu_fd1_1'>
          <benben-select-diy ref="showSelectPopup1699436603560" class-name='flex flex-wrap align-center flex'
            :items.sync="typeList" v-model="type" default-type="value" default-label="name" :allow-cancel='false'
            type="radio" :disabled='false'>
            <template v-for='(item,key0) in typeList'>
              <view v-if="item.isSelected" class='flex align-center justify-center flex wodefabu_fd1_1_c0_c0'
                :key="key0" @tap="$refs.showSelectPopup1699436603560.tapHandle(key0)">
                <text class='flex-sub wodefabu_fd1_1_c0_c0_c0'>{{item.name}}</text>
              </view>
              <view v-else class='flex align-center justify-center flex wodefabu_fd1_1_c0_c1' :key="key0"
                @tap="$refs.showSelectPopup1699436603560.tapHandle(key0)">
                <text class='flex-sub wodefabu_fd1_1_c0_c1_c0'>{{item.name}}</text>
              </view>
            </template></benben-select-diy>
        </view>
        <text class='wodefabu_fd1_2'>内容描述</text>
        <view class='flex flex-direction flex-wrap align-stretch wodefabu_fd1_3'>
          <view class='flex flex-wrap wodefabu_fd1_3_c0'>
            <textarea class='flex wodefabu_input_fd1_3_c0' confirm-type="done" :placeholder="'问题描述的越详细，有助于我们更快的解决问题'"
              :maxlength="240" :show-num='true' placeholder-style="color:#999;font-size:28rpx" v-model="content" />
            <template>
              <view class='flex flex justify-end wodefabu_numberfd1_3_c0_c0'>
                <text>{{content.length}}</text>
                <text>/</text>
                <text>240</text>
              </view>
            </template>
          </view>
          <view class='flex flex-direction flex-wrap align-stretch'>
            <view class='flex flex-wrap align-center wodefabu_fd1_3_c1_c0'>
              <text class='wodefabu_fd1_3_c1_c0_c0'>上传照片</text>
              <text class='wodefabu_fd1_3_c1_c0_c1'>最多上传8张</text>
            </view>
            <benben-images-upload ref="benbenImagesUploadfd1_3_c1_c1" :img-list.sync="imgurl" :img-ids.sync="images"
              :maxlength="8">
              <template #content="{ num, maxlength, isShow, imgList }">
                <view class="flex flex-wrap align-start flex wodefabu_fd1_3_c1_c1">

                  <view v-for="(image, index) in imgList" :key="index"
                    class='flex position-relative wodefabu_fd1_3_c1_c10'>
                    <text class='fu-iconfont2 position-absolute wodefabu_fd1_3_c1_c100'
                      @tap.stop="$refs.benbenImagesUploadfd1_3_c1_c1.delImage(index)">&#xE8E7;</text>
                    <image class='wodefabu_fd1_3_c1_c101'
                      @tap.stop="$refs.benbenImagesUploadfd1_3_c1_c1.previewImage(index)" mode="aspectFill"
                      :src='image'></image>
                  </view>

                  <image class='wodefabu_fd1_3_c1_c11' @tap.stop="$refs.benbenImagesUploadfd1_3_c1_c1.manyChooseImage()"
                    v-if="isShow" mode="aspectFit" :src='STATIC_URL+"297.jpg"'></image>

                </view>
              </template>
            </benben-images-upload>
          </view>
        </view>
        <text class='self-center wodefabu_fd1_4' @tap.stop="handleJumpDiy" data-type="navigateTo"
          :data-url="`/pages/sy/fabujilu/fabujilu`">发布记录</text>
        <button class='wodefabu_fd1_5' @tap.stop="submitFunc()">确认发布</button>
      </view>




    </view>
  </view>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js'
  export default {
    components: {},


    data() {
      return {
        "types": [{
          "name": "1",
          "value": "1",
          "image": ""
        }, {
          "name": "2",
          "value": "2",
          "image": ""
        }],
        "type": "1",
        "content": "",
        "images": "",
        "imgurl": [],
        "typeList": [{
          "name": "我的主意",
          "value": "1",
          "image": ""
        }, {
          "name": "我的烦恼",
          "value": "2",
          "image": ""
        }]
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {

    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      //提交
      async submitFunc() {
        if (!validate(this.content, 'require')) {
          this.$message.info('请输入内容不能为空');
          return false;
        }
        if (!validate(this.images, 'require')) {
          this.$message.info('图片不能为空');
          return false;
        }
        //请求方法
        //数据验证

        let data656fe9f773fe9 = await this.$api.post(global.apiUrls.post656fe9f773fe9, {
          type: this.type,
          content: this.content,
          images: this.images
        });

        if (data656fe9f773fe9.data.code != 1) {
          this.$message.info(data656fe9f773fe9.data.msg);
          return
        }



        this.$urouter.navigateBack(1);
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: var(--benbenbgColor1);
    background-size: 100% auto;
  }

  .wodefabu_flex_0 {
    border-bottom: 1px solid #eee;
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .wodefabu_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 500;
    color: #333333;
    line-height: 88rpx;
  }

  .wodefabu_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .wodefabu_fd0_0_c0 {
    width: 120rpx;
  }

  .wodefabu_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .wodefabu_flex_1 {
    background: #fff;
    background-size: 100% auto !important;
    position: relative;
  }

  .wodefabu_fd1_5 {
    background: rgba(255, 114, 46, 1);
    border-radius: 44rpx 44rpx 44rpx 44rpx;
    font-size: 32rpx;
    color: #fff;
    margin: 80rpx 32rpx 40rpx 32rpx;
    height: 88rpx;
    line-height: 88rpx;
    position: fixed;
    bottom: calc(80rpx + var(--window-bottom));
    width: 686rpx;
  }

  .wodefabu_fd1_4 {
    position: fixed;
    bottom: calc(50rpx + var(--window-bottom));
    color: #1A1A1A;
    font-size: 28rpx;
    font-weight: 500;
    left: 319rpx;
  }

  .wodefabu_fd1_3_c1_c11 {
    width: 160rpx;
    height: 160rpx;
    margin: 0rpx 24rpx 24rpx 0rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
  }

  .wodefabu_fd1_3_c1_c101 {
    width: 160rpx;
    height: 160rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
  }

  .wodefabu_fd1_3_c1_c100 {
    top: 0rpx;
    right: 0rpx;
    z-index: 10;
    color: #ff5536;
  }

  .wodefabu_fd1_3_c1_c10 {
    margin: 0rpx 24rpx 24rpx 0rpx;
  }

  .wodefabu_fd1_3_c1_c1 {
    padding: 24rpx 0rpx 0rpx 24rpx;
  }

  .wodefabu_fd1_3_c1_c0_c1 {
    color: #999999;
    font-size: 24rpx;
    font-weight: 500;
    margin: 24rpx 0rpx 24rpx 16rpx;
  }

  .wodefabu_fd1_3_c1_c0_c0 {
    color: #1A1A1A;
    font-size: 32rpx;
    font-weight: 500;
  }

  .wodefabu_fd1_3_c1_c0 {
    padding: 0rpx 0rpx 0rpx 24rpx;
  }

  .wodefabu_numberfd1_3_c0_c0 {
    width: 100%;
    font-size: 24rpx;
    color: var(--benbenFontColor0);
    line-height: 46rpx;
    font-weight: 400;
    padding: 0rpx 24rpx 0rpx 0rpx;
  }

  .wodefabu_input_fd1_3_c0 {
    width: 686rpx;
    font-size: 28rpx;
    font-weight: 400;
    color: #333;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
    padding: 24rpx 24rpx 0rpx 24rpx;
  }

  .wodefabu_fd1_3_c0 {
    background: #F6F7F9;
    width: 686rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
    margin: 0rpx 0rpx 0rpx 32rpx;
    padding: 0rpx 0rpx 24rpx 0rpx;
    background-size: 100% auto;
    height: 360rpx;
  }

  .wodefabu_fd1_3 {
    margin: 0rpx 0rpx 32rpx 0rpx;
  }

  .wodefabu_fd1_2 {
    font-size: 32rpx;
    font-weight: 500;
    color: #1A1A1A;
    line-height: 109rpx;
    margin: 0rpx 32rpx 0rpx 32rpx;
  }

  .wodefabu_fd1_1_c0_c1_c0 {
    border: 1px solid #BFBFBF;
    background: #FFFFFF;
    font-size: 28rpx;
    font-weight: 400;
    color: #999999;
    line-height: 62rpx;
    -webkit-line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    text-align: center;
    border-radius: 32rpx 32rpx 32rpx 32rpx;
  }

  .wodefabu_fd1_1_c0_c1 {
    background: var(--benbenbgColor4);
    height: 64rpx;
    border-radius: 8rpx;
    width: 206rpx;
    padding: 0rpx 10rpx 0rpx 10rpx;
    margin: 0rpx 16rpx 0rpx 0rpx;
  }

  .wodefabu_fd1_1_c0_c0_c0 {
    border: 1px solid #FF8533;
    background: rgba(255, 133, 51, 0.12);
    font-size: 28rpx;
    font-weight: 400;
    color: var(--benbenFontColor5);
    line-height: 62rpx;
    -webkit-line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    text-align: center;
    border-radius: 32rpx;
    margin: 0rpx 16rpx 0rpx 0rpx;
  }

  .wodefabu_fd1_1_c0_c0 {
    background: var(--benbenbgColor4);
    height: 64rpx;
    width: 206rpx;
    border-radius: 44rpx;
  }

  .wodefabu_fd1_1 {
    border-bottom: 1px solid rgba(246, 247, 248, 1);
    padding: 0rpx 16rpx 16rpx 16rpx;
  }

  .wodefabu_fd1_0_c0 {
    font-size: 32rpx;
    font-weight: 500;
    color: #1A1A1A;
    margin: 0rpx 32rpx 0rpx 32rpx;
  }

  .wodefabu_fd1_0 {
    padding: 32rpx 0rpx 32rpx 0rpx;
  }
</style>